package ru.urfc.portal.ui.client.widgets;

import ru.urfc.portal.ui.client.BaseGooglet;

import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Widget;

public class DocumentFilter extends BaseFilter {

	interface Binder extends UiBinder<Widget, DocumentFilter> {}
	private static Binder binder = GWT.create(Binder.class);

	@UiField ComboBox<ModelData> selectType;
	@UiField ComboBox<ModelData> selectState;
	@UiField Element placeForSearchButton;

	public DocumentFilter() {
		initWidget(binder.createAndBindUi(this));
		descriptor.addSelectField(FILTER_DOCUMENT_TYPE_CODE, selectType);
		descriptor.addSelectField(FILTER_DOCUMENT_STATE_CODE, selectState);
	}

	public void init(BaseGooglet googlet) {
		googlet.initCombobox("text", "code", "Все типы", selectType, DOCUMENT_TYPE, CATALOGS, DOCUMENT_TYPES);
		googlet.initCombobox("text", "code", "Все статусы", selectState, DOCUMENT_STATE, CATALOGS, DOCUMENT_STATES);
	}
	
	@Override
	protected Element getPlaceForSearchButton() {
		return placeForSearchButton;
	}
	
}